package com.jk.smartelderlycare.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.smartelderlycare.dao.SysPurchaseputMapper;
import com.jk.smartelderlycare.dto.SysProcurement;
import com.jk.smartelderlycare.dto.SysPurchaseput;
import com.jk.smartelderlycare.pojo.PagedResponse;
import com.jk.smartelderlycare.service.SysPurchaseputService;
import com.jk.smartelderlycare.utils.PaginationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author hhk
 * @version 1.0
 * @ClassName SysPurchaseputServiceImpl
 * @program: smart-elderly-care
 * @description: TODO
 * @date 2024/12/5 20:49
 */
@Service
public class SysPurchaseputServiceImpl implements SysPurchaseputService {
    @Autowired
    private SysPurchaseputMapper purchaseputMapper;
    /**
     * @description: 后端分页
     * @param: [sysPurchaseput, pageNum, pageSize]
     * @return: com.jk.smartelderlycare.pojo.PagedResponse<com.jk.smartelderlycare.dto.SysPurchaseput>
     * @author hhk
     * @date: 2024/12/5 20:58
     */
    @Override
    public PagedResponse<SysPurchaseput> findSysPurchaseputPaginationList(SysPurchaseput sysPurchaseput, Integer pageNum, Integer pageSize) {
        Page<SysPurchaseput> page = new Page<>(pageNum,pageSize);
        IPage<SysPurchaseput> procurementList =  purchaseputMapper.findSysPurchaseputPaginationList(sysPurchaseput,page);
        return PaginationUtil.getPagedResponse(procurementList.getRecords(),pageNum,pageSize,procurementList.getTotal());
    }
    /**
     * @description: 新增
     * @param: [sysPurchaseput]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:52
     */
    @Override
    public void addSysPurchaseput(SysPurchaseput sysPurchaseput) {

    }
    /**
     * @description: 删除
     * @param: [purchasePutid]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void deleteSysPurchaseputById(Long purchasePutid) {
        purchaseputMapper.deleteById(purchasePutid);
        purchaseputMapper.deleteSysPurchaseputById(purchasePutid);
    }
    /**
     * @description: 审核
     * @param: [purchasePutid]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void upStatusById(Long purchasePutid) {
        purchaseputMapper.upStatusById(purchasePutid);
    }
    /**
     * @description: 未审核
     * @param: [purchasePutid]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void downStatusById(Long purchasePutid) {
        purchaseputMapper.downStatusById(purchasePutid);
    }
    /**
     * @description: 回显
     * @param: [purchasePutid]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void findSysPurchaseputById(Long purchasePutid) {

    }
    /**
     * @description: 修改
     * @param: [sysPurchaseput]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void updateSysPurchaseput(SysPurchaseput sysPurchaseput) {
        purchaseputMapper.updateById(sysPurchaseput);
    }
    /**
     * @description: 导出
     * @param: []
     * @return: java.util.List<com.jk.smartelderlycare.dto.SysPurchaseput>
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public List<SysPurchaseput> findSysProcurement() {
        return purchaseputMapper.selectList(null);
    }
    /**
     * @description: 导入
     * @param: [sysPurchaseput]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void addProcurement(SysPurchaseput sysPurchaseput) {
        purchaseputMapper.insert(sysPurchaseput);
    }
    /**
     * @description: 关闭
     * @param: [purchasePutid]
     * @return: void
     * @author hhk
     * @date: 2024/12/5 20:53
     */
    @Override
    public void ShutdownStatusById(Long purchasePutid) {
        purchaseputMapper.ShutdownStatusById(purchasePutid);
    }
}
